# def get_num_index(llist,target):
#         #Todo 方法实现解决获取索引
#         '''
#         :param target: 俩个下标值的和
#         :param llist: 查看下标所用的列表
#         :return: 返回符合条件的两个下标值
#         '''
#         y=0
#         for x,val in enumerate(llist):
#             y += 1
#             if llist[x] +llist[y]==target:
#                 return (x,y)
#
# if __name__ == '__main__':
#     print(get_num_index([1,2,3,4,5,6],7))
#
#
# #闭包函数原理。。装饰器。。
#
# def num():
#     '''
#     :param i=i  外面每循环一次就把i赋值一次   最后可以得到不同的值  如没有 则等外面的循环完毕 i就赋值一个固定的值 3
#     :return: 返回的是一个列表推导式，里面是一个函数
#     '''
#     return [lambda x,i=i:i*x for i in range(4)]
# if __name__ == '__main__':
#     print([m(2) for m in num()])


# def get_num_index(llist, target):
#         # Todo 方法实现获取索引
#         '''
#         :param target: 给定值
#         :param llist: 查看条件列表
#         :return: 返回符合条件的下标值
#         '''
#         for i in llist:
#             y = target - i
#             if y != 0:
#                 if y in llist:
#                     if llist.index(i) == llist.index(y):
#                         break
#                     # if llist.index(i) <= llist.index(y):
#                     return llist.index(y), llist.index(i)
#             else:
#                 return llist.index(i)
#
# if __name__ == '__main__':
#     print(get_num_index([1, 2, 3, 4, 5, 6,13],13))



# def is_num(num):
#     '''
#     判断传递的参数是否是回文数
#     :param num: 传递的参数
#     :return: 是回文数返回True 不是则false
#     '''
#     num1 = str(num)
#     if num1[::-1] == num1:
#         return True
#     else:
#         return False
# if __name__ == '__main__':
#     print(is_num(121))

# def func(a=[]):
#     a.append(1)
#     print(a)
#
# func()
# func()
# func()

#这是生成器的斐波那契
# def gen_fib(num):
#     a1 = 0
#     a2 = 1
#     for i in range(num):
#         yield a1
#         a1,a2 = a2,a1+a2
# print(list(gen_fib(10)))

# class Solution:
#     def isUnique(self,astr:str)->bool:
#         mes_dict={}
#         for i in astr:
#             if mes_dict.get(i,""):
#                 return False
#             else:
#                 mes_dict[i] =1
#         return True
#
# s=Solution()
# print(s.isUnique("lev"))


# def fan(num):
#     '''
#     :param num: 传递的整数参数
#     :return:返回反转后的数值
#     '''
#     #负数情况下
#     if num < 0:
#         return -(int(str(num)[::-1].replace("-","")))
#     #等于大于0的情况下
#     if num >= 0:
#         return int(str(num)[::-1])
#
# print(fan(-120))


# def fan(num):
#     if num >= 0:
#         pass
#     if num < 0:
#         pass
#
# if __name__ == '__main__':
#     print(fan(-120))

# 比较取值第三大的数
def da(llist):
    llist.sort()
    if len(llist) < 3:
        return llist[-1]
    else:
        llist = list(set(llist))
        return llist[-3]


if __name__ == '__main__':
    print(da([3,1,1,3,4,4,5,6,6,6]))  #案例有问题  需要用set去重

'''
Stack() 创建一个新的空栈
push(item) 添加一个新的元素item到栈顶
pop() 弹出栈顶元素
peek() 返回栈顶元素
is_empty() 判断栈是否为空
size() 返回栈的元素个数
'''

# class Stack:
#     def init(self):
#         #设定一个空栈
#         self.stack = []
#     def push(self,item):
#         self.stack.append(item)
#     def pop(self):
#         #栈的特性 尾部删除，尾部添加
#         if self.stack ==[]:
#             return None
#         else:
#             self.stack.pop(-1)
#     def peek(self):
#         #返回栈顶元素
#         if self.stack ==[]:
#             return None
#         else:
#             return self.stack[-1]
#     def is_empty(self):
#         # 判断是否为空
#         return self.stack ==[]
#     def size(self):
#         #返回栈内元素的个数
#         return len(self.stack)


# def get_num(par_str):
#     """
#     :param par_str: 字符串
#     :return: num
#     """
#     par_list = par_str.split(' ')
#
#     # print([i for i in par_list if i])
#     # for i in par_list:
#     #     if "" in par_list:
#     #         par_list.remove("")
#     # print(par_list)
# if __name__ == '__main__':
#     get_num('hello, python   hello ,   world')


# 字符串相乘
# 给定两个以字符串形式表示的非负整数 num1 和 num2，返回 num1 和 num2 的乘积，它们的乘积也表示为字符串形式
# 示例 :
# 输入: num1 = "123", num2 = "456"
# 输出: "56088"

# def cheng(num1,num2):
#     i1=""
#     i2=""
#     for i in num1:
#         if i.isdigit():
#            i1+=i
#     for j in num2:
#         if  j.isdigit():
#             i2+=j
#     str1=str(int(i1)*int(i2))
#     return str1
# if __name__ == '__main__':
#     print(cheng('1122a','a133221aaaa'))

# def chong(llist):
#     for index,i in enumerate(llist):
#         i.get(i,"")
#
#
# if __name__ == '__main__':
#     print(chong([1,2,3,4,5,3,2]))

# from selenium import webdriver
# from selenium.webdriver.chrome.options import Options
#
# chrome_options = Options()
# # chrome_options.add_argument('--headless')     #不显示界面头等信息
# # chrome_options.add_argument('--disable-gpu')
# browser = webdriver.Chrome(chrome_options=chrome_options)
# browser.get("http://chinafoods.com.cn/")
# browser.find_element_by_id('sybm').send_keys("123456")
# browser.find_element_by_name("btncx").click()

# 给定一个字符串，你需要反转字符串中每个单词的字符顺序，同时仍保留空格和单词的初始顺序。
#
# 示例 1:
#
# 输入: "Let's take LeetCode contest"
# 输出: "s'teL ekat edoCteeL tsetnoc" 
# 注意：在字符串中，每个单词由单个空格分隔，并且字符串中不会有任何额外的空格。
#
# 来源：力扣（LeetCode）
# 链接：https://leetcode-cn.com/problems/reverse-words-in-a-string-iii
# 著作权归领扣网络所有。商业转载请联系官方授权，非商业转载请注明出处。

# def reverseWords(s):
#     """
#     :type s: str
#     :rtype: str
#     """
#     str1 = " ".join(reversed(s[::-1].split(" ")))
#     print(str1)
#
# if __name__ == '__main__':
#     reverseWords("Let's take LeetCode contest")


# 一球从100米高度自由落下，每次落地后反跳回原高度的一半；再落下，求它在第10次落地时，共经过多少米？第10次反弹多高？

# 100  50   25 12.5
# def num1(n):
#     if n==1:
#         return 100
#     else:
#         return num1(n-1)/2
#
# def nums(n):
#     if n==1:
#         return 100
#     else:# nums(n-1)/2
#         return 100*(1-(1/2)**n)*2*2-100
#
# if __name__ == '__main__':
#     print(num1(10))   #第10次的沟通
#     print(nums(10)) #求和


#冒泡排序
# def mao(list2):
#     for i in range(len(list2)-1):
#         for j in range(len(list2)-i-1):
#             if list2[j] > list2[j+1]:
#                 list2[j],list2[j+1]=list2[j+1],list2[j]
# if __name__ == '__main__':
#     list2 = [1,2,4,3,5,8,7]
#     mao(list2)
#     print(list2)


li3=[{"age":1,"b":2},{"age":3,"b":1},{"age":2,"b":1}]
# json_array = [{"a":1, "b":2},{"a":3, "b": 1},{"a":2, "b": 1}]
# json_array.sort(key = lambda x:x["a"])
# print(json_array)
# li3.sort(key = lambda x:x["age"])
# print(li3)
# for i in range(len(li3)-1):
#     if li3[i].get('age') > li3[i+1].get('age'):
#         li3[i],li3[i+1] = li3[i+1],li3[i]
# print(li3)

